function debug.RestartServ(p)
	
	if not (p:EntIndex() == 0 or p:IsAdmin()) then return end 
	
	RunningCurTime = CurTime()
	Msg("\n\n")
	local function RestartThink()
		if CurTime() > NextSecond then
			
			if FormattedTime == 0 then game.ConsoleCommand("changegamemode " .. game.GetMap().. " stargateww\n" ) end
			
			if FormattedTime == 5 then 
				for k,v in pairs(player.GetAll()) do
					v:SendSound(WW.Sounds.End2)
				end
			end
			
			NextSecond = CurTime() + 1
			FormattedTime = 10 - math.Round(NextSecond - RunningCurTime)
			
			if  FormattedTime != 0 then
				NotifyAll( "Server is restarting! " ..  FormattedTime, 1, true )
			else
				NotifyAll( "Server is restarting!", 2, false )
			end
			print("Server is going down for restart! " .. FormattedTime .. " seconds left!")
		end
	end
	hook.Add("Think", "RestartThink", RestartThink)
	Msg("\n\n")
	
end
concommand.Add("ww_restartserv", debug.RestartServ)

function debug.Restart(p)

	if not (p:EntIndex() == 0 or p:IsAdmin()) then return end 
	
	game.ConsoleCommand("changegamemode " .. game.GetMap().. " stargateww\n" )
	
end
concommand.Add("ww_restart", debug.Restart)

function debug.WhatTime(p)

	if p == nil then
	
		Msg("\n\nWe have " .. string.ToMinutesSeconds((30 * 60) - TimeStart) .. " minutes left until server restart!\n\n")
		
	else

		p:DebugPrint("\n\nWe have " .. string.ToMinutesSeconds((30 * 60) - TimeStart) .. " minutes left until server restart!\n\n")
		
	end
	
end
concommand.Add("ww_restarttime", debug.WhatTime)

function debug.ClassList(p)

	if p == nil then
	
		Msg("\n\n~~~~~~~~~~ Loading Classes ~~~~~~~~~~\n\n")
		Msg("The Flavor style is " .. Flavor .. "\n")
		for k,v in pairs(WWClass) do
			Msg( "Class " .. v.Class .. " Loaded, Team Number " .. v.Team .. " with starting argument at " .. v.ClassArg .. "\n")
		end
		Msg("\n\n")
		
	else

		p:DebugPrint("\n\n~~~~~~~~~~ Loading Classes ~~~~~~~~~~\n\n")
		p:DebugPrint("The Flavor style is " .. Flavor .. "\n")
		for k,v in pairs(WWClass) do
			p:DebugPrint( "Class " .. v.Class .. " Loaded, Team Number " .. v.Team .. " with starting argument at " .. v.ClassArg .. "\n")
		end
		p:DebugPrint("\n\n")
		
	end
	
end
concommand.Add("ww_classlist", debug.ClassList)

function debug.StartLog(p)

	if p == nil then
	
		Msg(FormattedStatus)
		
	else

		p:DebugPrint(FormattedStatus)
		
	end
	
end
concommand.Add("ww_log", debug.StartLog)

function debug.Players(p)

	if p == nil then
	
		Msg("\n\n")
		for k,v in pairs(player.GetAll()) do
			oldv = v
		
			for k,v in pairs(WWClass) do
				if oldv:Team() == v.Team then
					Msg( "Nick: " .. oldv:Nick() .. " Class: " .. v.Class .. " Argument: " .. v.ClassArg)
				end
			end
		end
		Msg("\n\n")
	
	else

		p:DebugPrint("\n\n")
		for k,v in pairs(player.GetAll()) do
			oldv = v
			
			for k,v in pairs(WWClass) do
				if oldv:Team() == v.Team then
					p:DebugPrint( "Nick: " .. oldv:Nick() .. " Class: " .. v.Class .. " Argument: " .. v.ClassArg)
				end
			end
		end
		p:DebugPrint("\n\n")
		
	end

end
concommand.Add("ww_playerlist", debug.Players)

function debug.ListChangelog(p)

	if p == nil then
	
		Msg(AChangeLog)
		
	else

		p:DebugPrint(AChangelog)

	end
	
end
concommand.Add("ww_listchangelog", debug.ListChangeLog)

function debug.ListCommands(p)

	if p == nil then
	
		for k,v in pairs(WW.Chat.Commands) do
			Msg("Command: " .. v.Command .. "\n		Argument: " .. v.Arg .. "\n		Length: " .. v.Length .. "\n")
		end
		
	else

		for k,v in pairs(WW.Chat.Commands) do
			p:DebugPrint("Command: " .. v.Command .. "\n		Argument: " .. v.Arg .. "\n		Length: " .. v.Length .. "\n")
		end
		
	end
	
end
concommand.Add("ww_chatcommands", debug.ListCommands)

concommand.Add("ww_pstats", debug.ListStats)

function debug.Version(p)

	if p == nil then
	
		Msg("\n\nStargate: World Wars version " .. WW.Version .. "!  Created by Prefanatic.\n\n")
	
	else

		p:DebugPrint("\n\nStargate: World Wars version " .. WW.Version .. "!  Created by Prefanatic.\n\n")
		
	end
	
end
concommand.Add("ww_ver", debug.Version)

ComList = {}

ComList["ww_log"] = "The startup logs of the server, usefull for information or curiosity."
ComList["ww_playerlist"] = "List of players, formatted in World Wars."
ComList["ww_classlist"] = "The Class List, helpful if you are creating a class plugin."
ComList["ww_restartserv"] = "Restart the server, 10 second delay."
ComList["ww_restart"] = "Restart the server instantly."
ComList["ww_listchangelog"] = "View the World Wars changelog!"
ComList["ww_chatcommands"] = "List all chat commands."
ComList["ww_ver"] = "Version Number"
ComList["ww_restarttime"] = "When the server will restart."

ComList["ww_commands"] = "Command List."

function debug.ComList(p)

	if p == nil then
		Msg("\n\n")
		for k,v in pairs(ComList) do Msg(k.. ": " .. v) end
		Msg("\n\n")
	else

		p:DebugPrint("\n\n")
		for k,v in pairs(ComList) do p:DebugPrint(k.. ": " .. v) end
		p:DebugPrint("\n\n")
	
	end
	
end
concommand.Add("ww_commands", debug.ComList)

function debug.AddToList()

	for k,v in pairs(ComList) do
		InsertServCommand( k, k, true )
	end
	
end